package com.codeZ.MementoPattern.instance;

/**
 * 客户端
 *
 * @author codeZhang
 * @Date 2024/8/30 14:17
 */
public class Client {


    public static void main(String[] args) {
        // 大战boss前
        System.out.println("大战boss前");
        GameRole gameRole = new GameRole();
        gameRole.initState();
        System.out.println("-----------------------------");
        // 保存进度
        RoleStateCaretaker roleStateCaretaker = new RoleStateCaretaker();
        roleStateCaretaker.setMemento(gameRole.saveState());

        // 大战boos后 没打过
        System.out.println("大战boss后");
        gameRole.fight();
        System.out.println("-----------------------------");

        // 恢复状态
        gameRole.recoverState(roleStateCaretaker.getMemento());

    }

}
